<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    import="util.Translator"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<% //Language management
	Translator t = new Translator();
	String lang = request.getParameter("lang");
	Cookie c = null;

	Cookie [] cookies = request.getCookies();
	if (cookies != null)
		for (Cookie i : cookies)
			if (i.getName().equals("vlang")) {
				c = i;
				break;
			}
	
	if (c == null)
		c = new Cookie("vlang", "en");
			
   if (lang != null) {
	   t.setLanguage(lang);
	   c.setValue(lang);
	}
	else
		t.setLanguage(c.getValue());
 
   response.addCookie(c);
%>

<html>
   <head>
      <link rel="stylesheet" type="text/css" href="css/regStyle.css">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title><%=t.translate("Buscar")%></title>
   </head>
   <body>
      <table class="mainTable">
         <tr>
            <td>
               <a href=home.jsp><img width="100px" height="50px" src="img/logo.jpg" /></a>
            </td>
         </tr>
         
         <tr> <td><hr color="#ffa200" width="100%" size="3px"/></td> </tr>

         <tr>
            <td>
               <form action="Search" method="get">
                  <table class="formTable">
                     <tr>
                        <td colspan="2"><%=t.translate("Tipo de propiedad")%> </td>
                        <td colspan="2">
                           <select name="tipoPropiedad" size="1" style="width: 100%;">
                              <option value="0"><%=t.translate("Cualquiera")%></option>
                              <option value="1"><%=t.translate("Solares")%></option>
                              <option value="2"><%=t.translate("Pisos")%></option>
                              <option value="3"><%=t.translate("Casas terreras")%></option>
                              <option value="4"><%=t.translate("Locales comerciales")%></option>
                           </select>
                        </td>
                     </tr>
                     <tr> <td colspan="4"> <hr color="#ffa200" width="100%" size="1px"/> </td> </tr>
                     <tr>
                        <td colspan="2"><%=t.translate("Tipo de oferta")%> </td>
                        <td colspan="2">
                           <select name="tipoOferta" size="1" style="width: 100%;">
                              <option value="0"><%=t.translate("Cualquiera")%></option>
                              <option value="1"><%=t.translate("Venta")%></option>
                              <option value="2"><%=t.translate("Alquiler")%></option>
                           </select>
                        </td>
                     </tr>
                     <tr> <td colspan="4"> <hr color="#ffa200" width="100%" size="1px"/> </td> </tr>
                     <tr>
                        <td colspan="2"><%=t.translate("Dimensiones")%> </td>
                        <td colspan="2">
                           <select name="tipoDimension" size="1" style="width: 100%;">
                              <option value="0"><%=t.translate("Cualquiera")%></option>
                              <option value="1"><%=t.translate("Menor que")%></option>
                              <option value="2"><%=t.translate("Entre")%></option>
                              <option value="3"><%=t.translate("Mayor que")%></option>
                           </select>
                        </td>
                     </tr>
                     <tr>
                        <td><%=t.translate("Mayor que")%> </td>
                        <td> <input type="text" name="minDimension"></input> </td>
                        <td><%=t.translate("Menor que")%> </td>
                        <td> <input type="text" name="maxDimension"></input> </td>
                     </tr>
                     <tr> <td colspan="4"> <hr color="#ffa200" width="100%" size="1px"/> </td> </tr>
                     <tr>
                        <td colspan="2"><%=t.translate("Precio")%> </td>
                        <td colspan="2">
                           <select name="tipoPrecio" size="1" style="width: 100%;">
                              <option value="0"><%=t.translate("Cualquiera")%></option>
                              <option value="1"><%=t.translate("Menor que")%></option>
                              <option value="2"><%=t.translate("Entre")%></option>
                              <option value="3"><%=t.translate("Mayor que")%></option>
                           </select>
                        </td>
                     </tr>
                     <tr>
                        <td><%=t.translate("Mayor que")%> </td>
                        <td> <input type="text" name="minPrecio"></input> </td>
                        <td><%=t.translate("Menor que")%> </td>
                        <td> <input type="text" name="maxPrecio"></input> </td>
                     </tr>
                     <tr>
                        <th colspan="4" class="centerButton">
                           <br>
                           <input type="submit" value=<%=t.translate("Buscar")%>>
                        </th>
                     </tr>
                  </table>
               </form>
            </td>
         </tr>
      </table>
   </body>
</html>